﻿Imports System
Imports System.Collections.Generic
Imports ASPNET.StarterKit.DataAccessLayer

Namespace ASPNET.StarterKit.BusinessLogicLayer

    Public Class Settings
        Private _key As String
        Private _value As String

        Public Sub New()
            _key = ""
            _value = ""

        End Sub

        Public Sub New(ByVal Key As String)
            If String.IsNullOrEmpty(Key) Then
                Throw New NullReferenceException("Key")
            End If

            Me._key = Key

        End Sub

        Public Sub New(ByVal Key As String, ByVal Value As String)

            If String.IsNullOrEmpty(Key) Then
                Throw New NullReferenceException("Key")
            End If
            If String.IsNullOrEmpty(Value) Then
                Throw New NullReferenceException("Value")
            End If

            Me._key = Key
            Me._value = Value

        End Sub


        Public Shared Function GetSetting(ByVal key As String) As String
            If String.IsNullOrEmpty(key) Then
                Throw New NullReferenceException("key")
            End If

            Return DataAccessHelper.GetDataAccess().GetAppSetting(key)

        End Function

        Public Shared Function SetSetting(ByVal key As String, ByVal value As String) As String
            If String.IsNullOrEmpty(key) Then
                Throw New NullReferenceException("key")
            End If
            If String.IsNullOrEmpty(value) Then
                Throw New NullReferenceException("value")
            End If

            Return DataAccessHelper.GetDataAccess().SetAppSetting(key, value)

        End Function


    End Class

End Namespace